package com.fr.report.script.function;

import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;
import com.fr.report.script.Primitive;
import com.fr.report.script.core.FunctionHelper;

public class COSH extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    if (paramArrayOfObject.length < 1)
      return Primitive.ERROR_NAME;
    Object localObject = paramArrayOfObject[0];
    if (localObject instanceof Number)
    {
      double d = ((Number)localObject).doubleValue();
      return FunctionHelper.parsePrimitiveDouble((Math.pow(2.718281828459045D, -d) + Math.pow(2.718281828459045D, d)) / 2.0D);
    }
    return Primitive.ERROR_NAME;
  }

  public Function.Type getType()
  {
    return Function.MATH;
  }

  public String getCN()
  {
    return "COSH(number): 返回一个数值的双曲线余弦值。\nNumber:需要求其双曲线余弦值的一个实数。\n备注:\n   双曲线余弦值计算公式为: ，其中e是自然对数的底，e=2.71828182845904。\n示例:\nCOSH(3)等于10.06766200。\nCOSH(5)等于74.20994852。\nCOSH(6)等于201.7156361。";
  }

  public String getEN()
  {
    return "COSH(number): Returns the hyperbolic cosine of a number.\nNumber is any real number for which you want to find the hyperbolic cosine.\n\nExample:\n   COSH(3)=10.06766200\n   COSH(5)=74.20994852\n   COSH(6)=201.7156361";
  }
}